package com.zyb.patient.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.zyb.patient.R;
import com.zyb.patient.widget.DashedCircularProgress;
import com.zyb.patient.widget.TimePickerDialog;

public class HomeFragment extends Fragment implements OnClickListener {
    
    private TextView mTitleBarText;
    private TextView mSettingsDate;
    private ImageView mTitleBarIcon;
    private ListView mlistView;
    LayoutInflater mInflater = null;
    private DashedCircularProgress mTreatementProgress = null;
	
    @Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        mInflater = inflater; 
		View view =  inflater.inflate(R.layout.fragment_home, null);
		mTitleBarText = (TextView)view.findViewById(R.id.title_bar_text);
		mTitleBarIcon = (ImageView)view.findViewById(R.id.title_bar_icon);
		mSettingsDate = (TextView)view.findViewById(R.id.settings_time);
		mlistView =(ListView)view.findViewById(R.id.class_list_view);
		mTreatementProgress = (DashedCircularProgress)view.findViewById(R.id.treatment_progress);
		return view;
	}
    
  
    
    public void initView(){
        mTitleBarText.setText("2015-10-10");
        mTreatementProgress.setValue(500f);
        mlistView.addHeaderView(mInflater.inflate(R.layout.listview_noclass_header, null));
        mlistView.setAdapter(null);
        mSettingsDate.setOnClickListener(this);
        mTitleBarIcon.setOnClickListener(this);
    }
    
    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        initView();
        super.onActivityCreated(savedInstanceState);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
        case R.id.title_bar_icon:
            break;
            
        case R.id.settings_time:
            TimePickerDialog timePickerDialog = new TimePickerDialog();
            timePickerDialog.show(getFragmentManager(), "timepicker");
            break;
        default:
            break;
        }
        
    }


}